package demo11;

import java.util.Date;

public class Date_time2 {
    public static void main(String[] args) {
        // printf格式化日期
        Date date = new Date();
        System.out.printf("%tY-%tm-%td %tH:%tM:%tS %tZ", date, date, date, date, date, date, date);
        System.out.printf("全部日期和时间信息：%tc%n", date);
        System.out.printf("年-月-日格式：%tF%n", date);
        System.out.printf("月/日/年格式：%tD%n", date);
        System.out.printf("HH:MM:SS PM格式：%tr%n", date);
        System.out.printf("HH:MM:SS格式（24时制）：%tT%n", date);
        System.out.printf("HH:MM格式（24时制）：%tR", date);
    }
}
